package io.gitee.yth.design.pattern.test.core.pattern.behavioral.state;

/**
 * 状态
 * --定义接口以封装与Context的一个特定状态相关的行为
 *
 * @author yth
 * @since 2023-05-03-0:17
 */
public abstract class AbstractTCPState implements TCPState {

    /**
     * 由子类具体状态决定什么时候改变状态
     */
    protected void changeState(TCPConnection tcpConnection, AbstractTCPState tcpState) {
        tcpConnection.changeState(tcpState);
    }

    @Override
    public void transmit(TCPConnection tcpConnection, TCPOctetStream tcpOctetStream) {
        throw new IllegalStateException("transmit");
    }

    @Override
    public void activeOpen(TCPConnection tcpConnection) {
        throw new IllegalStateException("activeOpen");
    }

    @Override
    public void passiveOpen(TCPConnection tcpConnection) {
        throw new IllegalStateException("passiveOpen");
    }

    @Override
    public void close(TCPConnection tcpConnection) {
        throw new IllegalStateException("close");
    }

    @Override
    public void synchronize(TCPConnection tcpConnection) {
        throw new IllegalStateException("synchronize");
    }

    @Override
    public void acknowledge(TCPConnection tcpConnection) {
        throw new IllegalStateException("acknowledge");
    }

    @Override
    public void send(TCPConnection tcpConnection) {
        throw new IllegalStateException("send");
    }

}
